using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlantAttack : MonoBehaviour
{
    private DetectionZone detectionZone;
    private Animator animator;


    void Start()
    {
        detectionZone = GetComponent<DetectionZone>();
        animator = GetComponent<Animator>();
    }

    void Update()
    {
        if (detectionZone.detectedObjs != null)
        {
            Vector2 direction = detectionZone.detectedObjs.transform.position - transform.position;
            direction = direction.normalized;


            animator.SetFloat("Plant1_X", direction.x);
            animator.SetFloat("Plant1_Y", direction.y);

        }
    }
}